<template>
  <div class="wjf-component">
    <el-dialog v-el-drag-dialog :title="title" :visible.sync="tempVisible" @closed="handlerClose">
      <el-form
        ref="dataForm"
        :model="temp"
        label-position="left"
        label-width="150px"
        style="width: 90%; margin-left:50px;"
      >
        <el-form-item label="物料名称" prop="materialName">
          <el-input v-model="temp.materialName" readonly />
        </el-form-item>
        <el-form-item label="物料编码" prop="materialId">
          <el-input v-model="temp.materialId" readonly />
        </el-form-item>
        <el-form-item label="价格" prop="price">
          <el-input v-model="temp.price" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="loading" type="primary" @click="submit">确定</el-button>
        <el-button @click="tempVisible = false">取消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<style>
</style>
<script>
import editCommon from '@/views/common/edit'
export default {
  mixins: [editCommon],
  props: {
    parentId: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      saveName: 'update',
      temp: {
        id: '',
        materialName: '',
        materialId: '',
        customerId: '',
        customerName: '',
        price: '',
        parentId: this.parentId,
        remark: ''
      }
    }
  },
  methods: {
    resetTemp() {
      this.temp = {
        id: '',
        materialName: '',
        materialId: '',
        customerId: '',
        customerName: '',
        price: '',
        parentId: this.parentId,
        remark: ''
      }
    }
  },
  watch: {
    parentId() {
      console.log(this.parentId)
      this.temp.parentId = this.parentId
    }
  }
}
</script>
